#include "Including.h"

using namespace std;

//The music that will be played
Mix_Music *music = NULL;
Mix_Chunk *wave = NULL;


//The sound effects that will be used
//Mix_Chunk *scratch = NULL;

namespace Sounds{

	bool MySounds::LoadSounds(const char *filename)
	{
		//Initialize SDL_mixer
		if( Mix_OpenAudio( 48000, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
		{
			cout<<"Initialize Sound Failed"<<endl;
			return false;
		}

		//Load the music
		music = Mix_LoadMUS( filename );
		
		//If there was a problem loading the music	
		if( music == NULL )
			return false;
		
		//Load the sound effects
		wave = Mix_LoadWAV( "Resources\\Sounds\\beat.wav" );
		
		//All initialized well
		return true;
	}


	void MySounds::CleanupSounds()
	{
		//Free the sound effects
		//Mix_FreeChunk( scratch );
	
		//Free the sounds
		Mix_FreeMusic( music );
	
		//Quit SDL_mixer
		Mix_CloseAudio();
	}
	
}